package com.example.demo.controller;


import com.example.demo.entity.ResponseVO;

public class BaseController {


    protected static final String COOKIE_KEY_TOKEN = "token";

    protected static final String STATUC_SUCCESS = "success";

    protected static final String STATUC_ERROR = "error";


    protected <T> ResponseVO getSuccess(String msg,T t) {
        ResponseVO<T> responseVO = new ResponseVO<>();
        responseVO.setStatus(STATUC_SUCCESS);
        responseVO.setCode(200);
        responseVO.setInfo(msg);
        responseVO.setData(t);
        return responseVO;
    }


    protected <T> ResponseVO getFail(String msg) {
        ResponseVO vo = new ResponseVO();
        vo.setStatus(STATUC_ERROR);
        vo.setCode(444);
        vo.setInfo(msg);
        vo.setData(null);
        return vo;
    }

}
